package com.chartboost.sdk;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Handler;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import com.chartboost.sdk.Libraries.CBOrientation;
import com.chartboost.sdk.Libraries.CBOrientation.Difference;
import com.chartboost.sdk.Libraries.d;
import com.chartboost.sdk.Libraries.e;
import com.chartboost.sdk.impl.a.b;
import com.chartboost.sdk.impl.a.c;
import com.chartboost.sdk.impl.j;
import com.chartboost.sdk.impl.j.c;
import com.chartboost.sdk.impl.k;
import com.chartboost.sdk.impl.k.a;
import com.chartboost.sdk.impl.l;
import com.chartboost.sdk.impl.m;
import com.chartboost.sdk.impl.m.a;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;

public final class Chartboost
{
  private static Chartboost b = null;
  private m.a A = new m.a()
  {
    public void a(String paramAnonymousString)
    {
      a locala = Chartboost.a(Chartboost.this);
      if ((locala != null) && (locala.a()))
        locala.a(true);
    }
  };
  private com.chartboost.sdk.impl.a.a B = new com.chartboost.sdk.impl.a.a()
  {
    private void a(JSONObject paramAnonymousJSONObject, String paramAnonymousString, k paramAnonymousk)
    {
      if (paramAnonymousJSONObject != null);
      try
      {
        if (paramAnonymousJSONObject.getString(paramAnonymousString) != null)
          paramAnonymousk.a(paramAnonymousString, paramAnonymousJSONObject.optString(paramAnonymousString));
        return;
      }
      catch (JSONException localJSONException)
      {
      }
    }

    public void a(com.chartboost.sdk.impl.a paramAnonymousa)
    {
      if (paramAnonymousa.c == a.b.b)
      {
        paramAnonymousa.c = a.b.a;
        if (paramAnonymousa.d == a.c.b)
          Chartboost.a(Chartboost.this, paramAnonymousa);
      }
      while (paramAnonymousa.c != a.b.e)
      {
        do
          return;
        while (paramAnonymousa.d != a.c.c);
        Chartboost.b(Chartboost.this, paramAnonymousa);
        return;
      }
      if ((paramAnonymousa.d == a.c.b) && (paramAnonymousa.e != null))
      {
        Chartboost.b(Chartboost.this).put(paramAnonymousa.e, paramAnonymousa);
        if (Chartboost.this.getDelegate() != null)
          Chartboost.this.getDelegate().didCacheInterstitial(paramAnonymousa.e);
      }
      while (true)
      {
        paramAnonymousa.c = a.b.f;
        return;
        if (paramAnonymousa.d == a.c.c)
        {
          if (Chartboost.this.getDelegate() != null)
            Chartboost.this.getDelegate().didCacheMoreApps();
          if (Chartboost.c(Chartboost.this) != null)
            Chartboost.c(Chartboost.this, null);
          Chartboost.c(Chartboost.this, paramAnonymousa);
        }
      }
    }

    public void a(com.chartboost.sdk.impl.a paramAnonymousa, final String paramAnonymousString, JSONObject paramAnonymousJSONObject)
    {
      Chartboost.d(Chartboost.this, null);
      int i;
      boolean bool2;
      label127: k localk;
      if ((paramAnonymousString != null) && (!paramAnonymousString.equals("")) && (!paramAnonymousString.equals("null")))
      {
        i = 1;
        if (paramAnonymousa.d != a.c.b)
          break label337;
        if (Chartboost.this.getDelegate() != null)
          Chartboost.this.getDelegate().didDismissInterstitial(paramAnonymousa.e);
        if (Chartboost.this.getDelegate() != null)
          Chartboost.this.getDelegate().didClickInterstitial(paramAnonymousa.e);
        if (paramAnonymousa.c == a.b.c)
        {
          a locala2 = Chartboost.a(Chartboost.this);
          if (locala2 != null)
          {
            bool2 = false;
            if (i == 0)
              break label331;
            locala2.a(paramAnonymousa, bool2);
          }
        }
        label135: localk = new k("api", "click");
        if (Chartboost.d(Chartboost.this) != null)
          break label440;
      }
      label440: for (Activity localActivity = Chartboost.this.b(); ; localActivity = Chartboost.d(Chartboost.this))
      {
        localk.a(localActivity);
        a(paramAnonymousa.a, "to", localk);
        a(paramAnonymousa.a, "cgn", localk);
        a(paramAnonymousa.a, "creative", localk);
        a(paramAnonymousa.a, "ad_id", localk);
        a(paramAnonymousJSONObject, "cgn", localk);
        a(paramAnonymousJSONObject, "creative", localk);
        a(paramAnonymousJSONObject, "type", localk);
        a(paramAnonymousJSONObject, "more_type", localk);
        localk.c(Chartboost.this.getAppID(), Chartboost.this.getAppSignature());
        if (i != 0)
        {
          localk.h = new k.a()
          {
            public void a(JSONObject paramAnonymous2JSONObject)
            {
              Chartboost.a(Chartboost.sharedChartboost(), paramAnonymous2JSONObject, paramAnonymousString);
            }
          };
          Chartboost.this.a(new a.a(true, null));
        }
        Chartboost.e(Chartboost.this).a(localk);
        return;
        i = 0;
        break;
        label331: bool2 = true;
        break label127;
        label337: if (paramAnonymousa.d != a.c.c)
          break label135;
        if (Chartboost.this.getDelegate() != null)
          Chartboost.this.getDelegate().didDismissMoreApps();
        if (Chartboost.this.getDelegate() != null)
          Chartboost.this.getDelegate().didClickMoreApps();
        if (paramAnonymousa.c != a.b.c)
          break label135;
        a locala1 = Chartboost.a(Chartboost.this);
        if (locala1 == null)
          break label135;
        boolean bool1 = false;
        if (i != 0);
        while (true)
        {
          locala1.a(paramAnonymousa, bool1);
          break;
          bool1 = true;
        }
      }
    }

    public void b(com.chartboost.sdk.impl.a paramAnonymousa)
    {
      Chartboost.d(Chartboost.this, null);
      if (paramAnonymousa.d == a.c.b)
      {
        if (Chartboost.this.getDelegate() != null)
          Chartboost.this.getDelegate().didDismissInterstitial(paramAnonymousa.e);
        if (Chartboost.this.getDelegate() != null)
          Chartboost.this.getDelegate().didCloseInterstitial(paramAnonymousa.e);
        if (paramAnonymousa.c == a.b.c)
        {
          a locala2 = Chartboost.a(Chartboost.this);
          if (locala2 != null)
            locala2.a(paramAnonymousa, true);
        }
      }
      a locala1;
      do
      {
        do
        {
          do
            return;
          while (paramAnonymousa.d != a.c.c);
          if (Chartboost.this.getDelegate() != null)
            Chartboost.this.getDelegate().didDismissMoreApps();
          if (Chartboost.this.getDelegate() != null)
            Chartboost.this.getDelegate().didCloseMoreApps();
        }
        while (paramAnonymousa.c != a.b.c);
        locala1 = Chartboost.a(Chartboost.this);
      }
      while (locala1 == null);
      locala1.a(paramAnonymousa, true);
    }

    public void c(com.chartboost.sdk.impl.a paramAnonymousa)
    {
      Chartboost localChartboost = Chartboost.this;
      a.c localc = paramAnonymousa.d;
      if (paramAnonymousa.d == a.c.b);
      for (String str = paramAnonymousa.e; ; str = null)
      {
        Chartboost.a(localChartboost, localc, str);
        return;
      }
    }
  };
  private j.c C = new j.c()
  {
    public void a(k paramAnonymousk)
    {
      if (paramAnonymousk.b.equals("get"))
        Chartboost.a(Chartboost.this, a.c.b, paramAnonymousk.e.optString("location", "Default"));
      while (true)
      {
        a locala = Chartboost.a(Chartboost.this);
        if ((locala != null) && (locala.a()))
          locala.a(true);
        return;
        if (paramAnonymousk.b.equals("more"))
          Chartboost.a(Chartboost.this, a.c.c, paramAnonymousk.e.optString("location", "Default"));
      }
    }

    public void a(JSONObject paramAnonymousJSONObject, k paramAnonymousk)
    {
      if (paramAnonymousk.h != null)
        paramAnonymousk.h.a(paramAnonymousJSONObject);
    }
  };
  protected Handler a = new Handler();
  private a c;
  private m d = new m(this.A);
  private Context e = null;
  private Activity f = null;
  private CBImpressionActivity g = null;
  private j h = new j(null, this.C, null);
  private List<a.a> i = new ArrayList();
  private Map<String, com.chartboost.sdk.impl.a> j = new HashMap();
  private com.chartboost.sdk.impl.a k = null;
  private com.chartboost.sdk.impl.a l;
  private String m;
  private String n;
  private ChartboostDelegate o;
  private int p = 30000;
  private boolean q = false;
  private CBOrientation r;
  private boolean s;
  private boolean t = false;
  private Map<Integer, Boolean> u = new HashMap();
  private Map<Integer, a> v = new HashMap();
  private boolean w = false;
  private long x = 0L;
  private boolean y = false;
  private Runnable z = new a(null);

  private void a(Activity paramActivity, boolean paramBoolean)
  {
    if (paramActivity == null)
      return;
    int i1 = paramActivity.hashCode();
    this.u.put(Integer.valueOf(i1), Boolean.valueOf(paramBoolean));
  }

  private void a(a.c paramc, String paramString)
  {
    a locala = e();
    if ((paramc == a.c.c) && (locala != null) && (locala.a()))
      locala.a(true);
    if ((paramc == a.c.b) && (getDelegate() != null))
      getDelegate().didFailToLoadInterstitial(paramString);
    if ((paramc == a.c.c) && (getDelegate() != null))
      getDelegate().didFailToLoadMoreApps();
  }

  private void a(final String paramString, final boolean paramBoolean)
  {
    if ((getDelegate() != null) && (!getDelegate().shouldRequestInterstitial(paramString)));
    do
    {
      return;
      if (l.a())
        break;
    }
    while (getDelegate() == null);
    getDelegate().didFailToLoadInterstitial(paramString);
    return;
    k localk = new k("api", "get");
    localk.a(this.f);
    localk.a("location", paramString);
    if (paramBoolean)
      localk.a("cache", "1");
    localk.c(getAppID(), getAppSignature());
    localk.h = new k.a()
    {
      public void a(JSONObject paramAnonymousJSONObject)
      {
        Chartboost.a(Chartboost.sharedChartboost(), paramAnonymousJSONObject, a.c.b, paramBoolean, paramString);
      }
    };
    this.h.a(localk);
  }

  private void a(JSONObject paramJSONObject, a.c paramc, boolean paramBoolean, String paramString)
  {
    if (!paramJSONObject.optString("status", "").equals("200"))
      a(paramc, paramString);
    int i1;
    int i2;
    do
    {
      return;
      if ((getDelegate() == null) || (getDelegate().shouldDisplayLoadingViewForMoreApps()))
        break;
      i1 = 0;
      a locala = e();
      i2 = 0;
      if (locala != null)
      {
        boolean bool = e().a();
        i2 = 0;
        if (bool)
          i2 = 1;
      }
    }
    while ((paramc == a.c.c) && (!paramBoolean) && (i1 != 0) && (i2 == 0));
    if (paramBoolean);
    for (a.b localb = a.b.e; ; localb = a.b.b)
    {
      new com.chartboost.sdk.impl.a(paramJSONObject, paramc, this.B, localb, paramString);
      return;
      i1 = 1;
      break;
    }
  }

  private void a(JSONObject paramJSONObject, String paramString)
  {
    this.d.a(paramString, this.f);
  }

  private void a(final boolean paramBoolean)
  {
    if (!l.a())
    {
      if (getDelegate() != null)
        getDelegate().didFailToLoadMoreApps();
      return;
    }
    if ((!paramBoolean) && ((getDelegate() == null) || (getDelegate().shouldDisplayLoadingViewForMoreApps())))
      a(new a.a(true, null));
    k localk = new k("api", "more");
    localk.a(this.f);
    if (paramBoolean)
      localk.a("cache", "1");
    localk.c(getAppID(), getAppSignature());
    localk.h = new k.a()
    {
      public void a(JSONObject paramAnonymousJSONObject)
      {
        Chartboost.a(Chartboost.this, paramAnonymousJSONObject, a.c.c, paramBoolean, null);
      }
    };
    this.h.a(localk);
  }

  private void b(Activity paramActivity, boolean paramBoolean)
  {
    int i1 = paramActivity.hashCode();
    a locala1 = (a)this.v.get(Integer.valueOf(i1));
    if ((locala1 == null) && (paramBoolean))
      if (this.c != null)
      {
        locala2 = this.c;
        this.c = null;
        locala2.a(paramActivity);
        this.v.put(Integer.valueOf(i1), locala2);
      }
    while ((locala1 == null) || (paramBoolean))
      while (true)
      {
        return;
        a locala2 = new a(this, paramActivity);
      }
    this.c = ((a)this.v.remove(Integer.valueOf(i1)));
  }

  private void b(com.chartboost.sdk.impl.a parama)
  {
    if ((!parama.k) && (getDelegate() != null) && (!getDelegate().shouldDisplayInterstitial(parama.e)))
      return;
    if ((parama.c == a.b.f) && (this.j.get(parama.e) == parama))
    {
      this.j.remove(parama.e);
      k localk = new k("api", "show");
      localk.a(this.f);
      String str = parama.a.optString("ad_id");
      if (str != null)
        localk.a("ad_id", str);
      localk.c(getAppID(), getAppSignature());
      this.h.a(localk);
    }
    parama.c = a.b.b;
    a(new a.a(parama));
  }

  private void c(Activity paramActivity)
  {
    this.f = paramActivity;
    this.e = paramActivity.getApplicationContext();
  }

  private void c(com.chartboost.sdk.impl.a parama)
  {
    int i1 = 1;
    if ((!parama.k) && (getDelegate() != null) && (!getDelegate().shouldDisplayMoreApps()))
      return;
    if (parama == this.k)
      this.k = null;
    int i2;
    if (parama.c == a.b.f)
    {
      i2 = i1;
      parama.c = a.b.a;
      if ((getDelegate() != null) && (!getDelegate().shouldDisplayLoadingViewForMoreApps()))
        i1 = 0;
      a locala = e();
      if (locala != null)
      {
        if ((!locala.a()) && (i1 != 0))
          break label140;
        if (i1 != 0)
          locala.a(false);
      }
    }
    label140: 
    while ((i2 != 0) || (parama.j))
    {
      parama.c = a.b.b;
      a(new a.a(parama));
      return;
      i2 = 0;
      break;
    }
  }

  private boolean d()
  {
    return d(this.f);
  }

  private boolean d(Activity paramActivity)
  {
    if (paramActivity == null)
      return false;
    Boolean localBoolean = (Boolean)this.u.get(Integer.valueOf(paramActivity.hashCode()));
    if (localBoolean != null);
    for (boolean bool = localBoolean.booleanValue(); ; bool = false)
      return bool;
  }

  private a e()
  {
    if (b() == null)
      return null;
    return (a)this.v.get(Integer.valueOf(b().hashCode()));
  }

  private void f()
  {
    if (this.l == null)
      return;
    this.B.b(this.l);
  }

  public static Chartboost sharedChartboost()
  {
    try
    {
      if (b == null)
        b = new Chartboost();
      Chartboost localChartboost = b;
      return localChartboost;
    }
    finally
    {
    }
  }

  protected void a(Activity paramActivity)
  {
    this.e = paramActivity.getApplicationContext();
    if (!(paramActivity instanceof CBImpressionActivity))
    {
      this.f = paramActivity;
      a(this.f, true);
    }
    while (true)
    {
      this.a.removeCallbacks(this.z);
      if ((paramActivity != null) && (paramActivity == b()))
        break;
      return;
      this.g = ((CBImpressionActivity)paramActivity);
    }
    b(paramActivity, true);
    a locala;
    int i2;
    if ((paramActivity instanceof CBImpressionActivity))
    {
      locala = e();
      if (locala != null)
      {
        i2 = 0;
        label89: if (i2 >= this.i.size())
          this.i.clear();
      }
      else
      {
        this.y = false;
      }
    }
    else
    {
      if (!this.w)
        break label205;
      this.w = false;
    }
    label205: for (int i1 = 1; ; i1 = 0)
    {
      if ((this.l != null) && (this.l.c == a.b.b) && (this.l.a()))
        i1 = 0;
      if (i1 == 0)
        break;
      a(new a.a(true, null));
      return;
      locala.a((a.a)this.i.get(i2));
      i2++;
      break label89;
    }
  }

  protected void a(CBImpressionActivity paramCBImpressionActivity)
  {
    if (!this.t)
    {
      this.e = paramCBImpressionActivity.getApplicationContext();
      this.g = paramCBImpressionActivity;
      this.t = true;
    }
    this.a.removeCallbacks(this.z);
  }

  protected void a(a.a parama)
  {
    boolean bool1 = true;
    if (getImpressionsUseActivities())
    {
      a locala2 = e();
      if ((b() != null) && (this.t) && (locala2 != null))
        locala2.a(parama);
    }
    label121: a locala1;
    label175: label181: 
    do
    {
      do
        return;
      while (!d());
      this.i.add(parama);
      Intent localIntent = new Intent(this.f, CBImpressionActivity.class);
      boolean bool2;
      boolean bool3;
      if ((0x400 & this.f.getWindow().getAttributes().flags) != 0)
      {
        bool2 = bool1;
        if ((0x800 & this.f.getWindow().getAttributes().flags) == 0)
          break label175;
        bool3 = bool1;
        if ((!bool2) || (bool3))
          break label181;
      }
      while (true)
      {
        localIntent.putExtra("paramFullscreen", bool1);
        try
        {
          this.f.startActivity(localIntent);
          this.y = true;
          return;
        }
        catch (ActivityNotFoundException localActivityNotFoundException)
        {
          throw new RuntimeException("Chartboost impression activity not declared in manifest. Please add the following inside your manifest's <application> tag: \n<activity android:name=\"com.chartboost.sdk.CBImpressionActivity\" android:theme=\"@android:style/Theme.Translucent.NoTitleBar\" android:excludeFromRecents=\"true\" />");
        }
        bool2 = false;
        break;
        bool3 = false;
        break label121;
        bool1 = false;
      }
      locala1 = e();
    }
    while (locala1 == null);
    locala1.a(parama);
  }

  protected void a(com.chartboost.sdk.impl.a parama)
  {
    this.l = parama;
  }

  protected boolean a()
  {
    if ((this.l != null) && (this.l.c == a.b.c))
    {
      f();
      return true;
    }
    a locala = e();
    if ((locala != null) && (locala.a()))
    {
      locala.a(true);
      return true;
    }
    return false;
  }

  protected Activity b()
  {
    if (this.q)
      return this.g;
    return this.f;
  }

  protected void b(Activity paramActivity)
  {
    a locala = e();
    if ((paramActivity == b()) && (locala != null))
    {
      b(paramActivity, false);
      this.w = false;
      if (locala.a())
      {
        locala.a(false);
        this.w = true;
      }
      if (this.l != null)
        locala.a(this.l);
    }
    if (!(paramActivity instanceof CBImpressionActivity))
      a(this.f, false);
  }

  protected void c()
  {
    if (this.t)
    {
      this.e = this.f.getApplicationContext();
      this.g = null;
      this.t = false;
    }
  }

  public void cacheInterstitial()
  {
    cacheInterstitial("Default");
  }

  public void cacheInterstitial(String paramString)
  {
    if (this.f == null)
      throw new IllegalStateException("The context must be set through the Chartboost method onCreate() before calling cacheInterstitial().");
    if ((getDelegate() != null) && (!getDelegate().shouldRequestInterstitialsInFirstSession()) && (d.a().getInt("cbPrefSessionCount", 0) <= 1))
      return;
    a(paramString, true);
  }

  public void cacheMoreApps()
  {
    if (this.f == null)
      throw new IllegalStateException("The context must be set through the Chartboost method onCreate() before calling cacheMoreApps().");
    a(true);
  }

  public void clearCache()
  {
    this.j = new HashMap();
  }

  public void clearImageCache()
  {
    e.a().b();
  }

  public String getAppID()
  {
    return this.m;
  }

  public String getAppSignature()
  {
    return this.n;
  }

  public Context getContext()
  {
    return this.e;
  }

  public ChartboostDelegate getDelegate()
  {
    return this.o;
  }

  public CBOrientation.Difference getForcedOrientationDifference()
  {
    if (!this.s)
      return CBOrientation.Difference.ANGLE_0;
    CBOrientation localCBOrientation1 = d.c(getContext());
    CBOrientation localCBOrientation2 = orientation();
    if ((localCBOrientation2 == CBOrientation.UNSPECIFIED) || (localCBOrientation2 == localCBOrientation1))
      return CBOrientation.Difference.ANGLE_0;
    if (localCBOrientation2 == localCBOrientation1.rotate90())
      return CBOrientation.Difference.ANGLE_90;
    if (localCBOrientation2 == localCBOrientation1.rotate180())
      return CBOrientation.Difference.ANGLE_180;
    return CBOrientation.Difference.ANGLE_270;
  }

  public boolean getImpressionsUseActivities()
  {
    return this.q;
  }

  public int getTimeout()
  {
    return this.p;
  }

  public boolean hasCachedInterstitial()
  {
    return hasCachedInterstitial("Default");
  }

  public boolean hasCachedInterstitial(String paramString)
  {
    com.chartboost.sdk.impl.a locala = (com.chartboost.sdk.impl.a)this.j.get(paramString);
    if (locala == null)
      return false;
    if (TimeUnit.MILLISECONDS.toSeconds(new Date().getTime() - locala.b.getTime()) < 86400L);
    for (boolean bool = true; ; bool = false)
      return bool;
  }

  public boolean hasCachedMoreApps()
  {
    return this.k != null;
  }

  public boolean isIdentityTrackingDisabledOnThisDevice()
  {
    return d.c();
  }

  public boolean onBackPressed()
  {
    if (!d.d())
      throw new IllegalStateException("It is illegal to call this method from any thread other than the UI thread. Please call it from the onBackPressed() method of your host activity.");
    if (this.f == null)
      throw new IllegalStateException("The Chartboost methods onCreate(), onStart(), onStop(), and onDestroy() must be called in the corresponding methods of your activity in order for Chartboost to function properly.");
    if (this.q)
    {
      boolean bool1 = this.y;
      boolean bool2 = false;
      if (bool1)
      {
        this.y = false;
        a();
        bool2 = true;
      }
      return bool2;
    }
    return a();
  }

  public void onCreate(Activity paramActivity, String paramString1, String paramString2, ChartboostDelegate paramChartboostDelegate)
  {
    if (!d.d())
      throw new IllegalStateException("It is illegal to call this method from any thread other than the UI thread. Please call it from the onCreate() method of your host activity.");
    if ((this.f != null) && (d()) && (this.f != paramActivity))
    {
      onStop(this.f);
      a(this.f, false);
    }
    this.a.removeCallbacks(this.z);
    c(paramActivity);
    setAppID(paramString1);
    setAppSignature(paramString2);
    setDelegate(paramChartboostDelegate);
  }

  public void onDestroy(Activity paramActivity)
  {
    this.a.postDelayed(this.z, 10000L);
  }

  public void onStart(Activity paramActivity)
  {
    if (!d.d())
      throw new IllegalStateException("It is illegal to call this method from any thread other than the UI thread. Please call it from the onStart() method of your host activity.");
    this.a.removeCallbacks(this.z);
    a(paramActivity, true);
    c(paramActivity);
    if (!this.q)
      a(paramActivity);
  }

  public void onStop(Activity paramActivity)
  {
    if (!d.d())
      throw new IllegalStateException("It is illegal to call this method from any thread other than the UI thread. Please call it from the onStop() method of your host activity.");
    if (!this.q)
      b(paramActivity);
    if (!(paramActivity instanceof CBImpressionActivity))
      a(paramActivity, false);
    this.x = (()(System.nanoTime() / 1000000.0D));
  }

  public CBOrientation orientation()
  {
    if (getContext() == null)
      throw new IllegalStateException("The context must be set through the Chartboost method onCreate() before calling orientation().");
    if ((this.s) && (this.r != CBOrientation.UNSPECIFIED))
      return this.r;
    return d.c(getContext());
  }

  public void setAppID(String paramString)
  {
    this.m = paramString;
  }

  public void setAppSignature(String paramString)
  {
    this.n = paramString;
  }

  public void setDelegate(ChartboostDelegate paramChartboostDelegate)
  {
    this.o = paramChartboostDelegate;
  }

  public void setIdentityTrackingDisabledOnThisDevice(boolean paramBoolean)
  {
    SharedPreferences.Editor localEditor = d.a().edit();
    localEditor.putBoolean("cbIdentityTrackingDisabled", paramBoolean);
    localEditor.commit();
  }

  public void setImpressionsUseActivities(boolean paramBoolean)
  {
    this.q = paramBoolean;
  }

  public void setOrientation(CBOrientation paramCBOrientation)
  {
    if (paramCBOrientation != CBOrientation.UNSPECIFIED);
    for (boolean bool = true; ; bool = false)
    {
      this.s = bool;
      this.r = paramCBOrientation;
      return;
    }
  }

  public void setTimeout(int paramInt)
  {
    this.p = paramInt;
  }

  public void showInterstitial()
  {
    showInterstitial("Default");
  }

  public void showInterstitial(String paramString)
  {
    if (this.f == null)
      throw new IllegalStateException("The context must be set through the Chartboost method onCreate() before calling showInterstitial().");
    if ((getDelegate() != null) && (!getDelegate().shouldRequestInterstitialsInFirstSession()) && (d.a().getInt("cbPrefSessionCount", 0) == 1))
      return;
    b localb = new b(paramString);
    this.a.post(localb);
  }

  public void showMoreApps()
  {
    if (this.f == null)
      throw new IllegalStateException("The context must be set through the Chartboost method onCreate() before calling showMoreApps().");
    c localc = new c(null);
    this.a.post(localc);
  }

  public void startSession()
  {
    if (this.f == null)
      throw new IllegalStateException("The context must be set through the Chartboost method onCreate() before calling startSession().");
    if (()(System.nanoTime() / 1000000.0D) - this.x < 10000L)
      return;
    SharedPreferences localSharedPreferences = d.a();
    int i1 = 1 + localSharedPreferences.getInt("cbPrefSessionCount", 0);
    SharedPreferences.Editor localEditor = localSharedPreferences.edit();
    localEditor.putInt("cbPrefSessionCount", i1);
    localEditor.commit();
    k localk = new k("api", "install");
    localk.a(this.f);
    localk.c(getAppID(), getAppSignature());
    localk.h = new k.a()
    {
      public void a(JSONObject paramAnonymousJSONObject)
      {
        if (d.a(Chartboost.this.getContext()))
        {
          String str = paramAnonymousJSONObject.optString("latest-sdk-version");
          if ((str != null) && (!str.equals("")) && (!str.equals("3.1.5")))
            Log.w("Chartboost", String.format("WARNING: you have an outdated version of the SDK (Current: %s, Latest: %s). Get the latest version at chartboost.com/support/sdk#android", new Object[] { str, "3.1.5" }));
        }
      }
    };
    this.h.a(localk);
  }

  private class a
    implements Runnable
  {
    private int b;
    private int c;
    private int d;

    private a()
    {
      int j;
      int k;
      if (Chartboost.f(Chartboost.this) == null)
      {
        j = i;
        this.b = j;
        if (Chartboost.d(Chartboost.this) != null)
          break label65;
        k = i;
        label35: this.c = k;
        if (Chartboost.g(Chartboost.this) != null)
          break label77;
      }
      while (true)
      {
        this.d = i;
        return;
        j = Chartboost.f(Chartboost.this).hashCode();
        break;
        label65: k = Chartboost.d(Chartboost.this).hashCode();
        break label35;
        label77: i = Chartboost.g(Chartboost.this).hashCode();
      }
    }

    public void run()
    {
      if ((Chartboost.d(Chartboost.this) != null) && (Chartboost.d(Chartboost.this).hashCode() == this.c))
        Chartboost.a(Chartboost.this, null);
      if ((Chartboost.f(Chartboost.this) != null) && (Chartboost.f(Chartboost.this).hashCode() == this.b))
        Chartboost.a(Chartboost.this, null);
      if ((Chartboost.g(Chartboost.this) != null) && (Chartboost.g(Chartboost.this).hashCode() == this.d))
        Chartboost.a(Chartboost.this, null);
      Chartboost.this.clearImageCache();
    }
  }

  private class b
    implements Runnable
  {
    private String b;

    public b(String arg2)
    {
      Object localObject;
      this.b = localObject;
    }

    public void run()
    {
      if (Chartboost.this.hasCachedInterstitial(this.b))
      {
        Chartboost.a(Chartboost.this, (com.chartboost.sdk.impl.a)Chartboost.b(Chartboost.this).get(this.b));
        return;
      }
      Chartboost.a(Chartboost.this, this.b, false);
    }
  }

  private class c
    implements Runnable
  {
    private c()
    {
    }

    public void run()
    {
      if (Chartboost.c(Chartboost.this) != null)
      {
        Chartboost.b(Chartboost.this, Chartboost.c(Chartboost.this));
        return;
      }
      Chartboost.a(Chartboost.this, false);
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.chartboost.sdk.Chartboost
 * JD-Core Version:    0.6.2
 */